#include "syscall.h"

int main()
{
	int testMV;
	WriteFormat("----------Test Case V--------\n",31,0,0);
	WriteFormat("/*Test for MV-related system calls*/\n",38,0,0);
	WriteFormat("5-0 Prepare MV for test\n",25,0,0);
	testMV=CreateMV("testMV",6,10,0);
	WriteFormat("5-1 Bullet Proof of CreateMV syscall\n",36,0,0);

	WriteFormat("    Create MV with wrong address of name\n",42,0,0);
	CreateMV(-1,10,10,0);
	WriteFormat("    Create should failed because this name address is out of virtual address \n",79,0,0);

	WriteFormat("    Create MV with extrem long name length\n",44,0,0);
	CreateMV("testname",10000000,10,0);
	WriteFormat("    Create MV should FAIL because this name length is too long and exceed virtual address \n",92,0,0);
	WriteFormat("    Create MV with extreme long array length\n",49,0,0);
	CreateMV("testname",7,1000000,0);
	WriteFormat("    Create MV should FAIL because this array length is too long and exceed virtual address \n",93,0,0);

	WriteFormat("5-2 Bullet Proof of GetMV syscall\n",35,0,0);
	WriteFormat("    Trying to Get the MV with index 100\n",41,0,0);
	GetMV(100,1);
	WriteFormat("    Get MV should FAIL because this MV doesn't exist \n",55,0,0);
	WriteFormat("    Trying to Get value of index 100 in testMV\n",48,0,0);
	GetMV(testMV,100);
	WriteFormat("    Get MV should FAIL because this index beyond the MV's length \n",67,0,0);
	WriteFormat("    Trying to Get MV -1 \n",26,0,0);
	GetMV(-1,1);
	WriteFormat("    Get MV should FAIL because this index is out of bound \n",60,0,0);
	WriteFormat("    Trying to Get MV 10000\n",28,0,0);
	GetMV(10000,1);
	WriteFormat("    Get MV should FAIL because this index is out of bound \n",60,0,0);
	WriteFormat("    Trying to Get value with index 10000 of testMV \n",53,0,0);
	GetMV(testMV,10000);
	WriteFormat("    Get MV should FAIL because this index is out of bound \n",60,0,0);
	WriteFormat("    Trying to Get the value with index -1 of testMV",26,0,0);
	GetMV(testMV,-1);
	WriteFormat("    Get MV should FAIL because this index is out of bound \n",60,0,0);
	

	WriteFormat("5-3 Bullet Proof of SetMV syscall\n",35,0,0);
	WriteFormat("    Trying to Set the MV with index 100\n",41,0,0);
	SetMV(100,1,100);
	WriteFormat("    Set MV should FAIL because this MV doesn't exist \n",55,0,0);
	WriteFormat("    Trying to Set value to index 100 of testMV\n",39,0,0);
	SetMV(testMV,100,100);
	WriteFormat("    Set MV should FAIL because this index beyond the MV's length \n",67,0,0);
	WriteFormat("    Trying to Set MV -1 \n",26,0,0);
	SetMV(-1,1,0);
	WriteFormat("    Set MV should FAIL because this index is out of bound \n",60,0,0);
	WriteFormat("    Trying to Set MV 10000\n",28,0,0);
	SetMV(10000,1,0);
	WriteFormat("    Set MV should FAIL because this index is out of bound \n",60,0,0);
	WriteFormat("    Trying to Set value to index -1 of testMV \n",48,0,0);
	SetMV(testMV,-1,0);
	WriteFormat("    Set MV should FAIL because this index is out of bound \n",60,0,0);
	WriteFormat("    Trying to Set value to index 10000 of testMV \n",51,0,0);
	SetMV(testMV,10000,0);
	WriteFormat("    Set MV should FAIL because this index is out of bound \n",60,0,0);


	WriteFormat("5-4 Bullet Proof of DestroyMV syscall\n",39,0,0);
	WriteFormat("    Trying to Destroy the MV with index 100\n",45,0,0);
	DestroyMV(100);
	WriteFormat("    Destroy MV should FAIL because this MV doesn't exist \n",59,0,0);
	WriteFormat("    Trying to Destroy the MV with index -1\n",44,0,0);
	DestroyMV(-1);
	WriteFormat("    Destroy MV should FAIL because this index is out of bound \n",64,0,0);
	WriteFormat("    Trying to Destroy the MV with index 10000\n",47,0,0);
	DestroyMV(10000);
	WriteFormat("    Destroy MV should FAIL because this index is out of bound \n",64,0,0);
	
	WriteFormat("------------test end-----------\n",33,0,0);
}
